Source for file SC_UploadFile.php
Documentation is available at SC_UploadFile.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once($SC_UPLOADFILE_DIR .
"/../module/gdthumb.php");
function addFile($disp_name, $keyname, $arrExt, $size, $necessary=
false, $width=
0, $height=
0, $image=
true) {
function makeThumb($src_file, $width, $height) {
$dst_file =
$this->temp_dir .
$uniqname;
$objThumb =
new gdthumb();
$ret =
$objThumb->Main($src_file, $width, $height, $dst_file);
// FIXME see. http://www.php.net/manual/en/features.file-upload.php
if(!($_FILES[$keyname]['size'] >
0)) {
$objErr->arrErr[$keyname] =
"※ " .
$this->disp_name[$arrKeyname[$keyname]] .
"がアップロードされていません。<br />";
$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array("FILE_EXT_CHECK"));
$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK"));
if(!isset
($objErr->arrErr[$keyname])) {
$this->temp_file[$cnt] =
$_FILES[$keyname]['name'];
return $objErr->arrErr[$keyname];
$arrRet["temp_" .
$val] =
$this->temp_file[$cnt];
$arrRet["save_" .
$val] =
$this->save_file[$cnt];
// HIDDENで送られてきたファイル名を取得する
if(isset
($arrPOST[$key]) &&
!empty($arrPOST[$key])) {
if(isset
($arrPOST[$key]) &&
!empty($arrPOST[$key])) {
// ファイルパスチェック(パスのスラッシュ/が連続しないようにする。)
if(ereg("/$", $temp_url)) {
$arrRet[$val]['filepath'] =
$temp_url .
$this->temp_file[$cnt];
$arrRet[$val]['filepath'] =
$temp_url .
"/" .
$this->temp_file[$cnt];
// ファイルパスチェック(パスのスラッシュ/が連続しないようにする。)
if(ereg("/$", $save_url)) {
$arrRet[$val]['filepath'] =
$save_url .
$this->save_file[$cnt];
$arrRet[$val]['filepath'] =
$save_url .
"/" .
$this->save_file[$cnt];
if(isset
($arrRet[$val]['filepath']) &&
!empty($arrRet[$val]['filepath'])) {
if(is_file($arrRet[$val]['real_filepath'])) {
list
($width, $height) =
getimagesize($arrRet[$val]['real_filepath']);
$arrRet[$val]['width'] =
$width;
$arrRet[$val]['height'] =
$height;
$arrRet[$val]['width'] =
$this->width[$cnt];
$arrRet[$val]['height'] =
$this->height[$cnt];
$arrRet[$val]['disp_name'] =
$this->disp_name[$cnt];
if(isset
($arrVal[$val]) &&
$arrVal[$val] !=
"") {
if($arrVal[$val] !=
"" &&
$val ==
'tv_products_image') {
// DB上のファイルの内削除要求があったファイルを削除する。
if($arrVal[$val] !=
"") {
if($this->save_file[$cnt] ==
"" &&
!ereg("^sub/", $arrVal[$val])) {
$objImage->deleteImage($arrVal[$val], $this->save_dir);
if($val ==
$keyname ||
$keyname ==
"") {
$arrRet[$val] =
"※ " .
$this->disp_name[$cnt] .
"がアップロードされていません。<br>";
$file =
$this->temp_file[$arrImageKey[$keyname]];
$path =
$this->makeThumb($filepath, $to_w, $to_h);
Documentation generated on Tue, 28 Apr 2009 18:13:43 +0900 by phpDocumentor 1.4.2